Type-based optimizations such as de-virtualization in C++ programs depend on knowledge of the complete type hierarchy in the program being optimized. However features such as static libraries, which are linked with the program at build time, and dynamic libraries which are linked at run-time, introduce unknown types which the optimizer does not know about. Without complete knowledge the optimizer can perform program transformations which are incorrect due to being over optimistic. Invasion analysis addresses the problem of determining which parts of the type hierarchy are to be treated conservatively by the optimizer so that it only performs correct optimizations. It is crucial for making type based optimizations practical in a production compiler.